export function isMobile() {
  // UA检测优先
  const ua = navigator.userAgent
  if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(ua)) {
    return true
  }

  // 在uni-app环境中补充检测
  if (typeof uni !== 'undefined') {
    try {
      const { platform, deviceType } = uni.getSystemInfoSync()
      return ['android', 'ios'].includes(platform) || deviceType === 'mobile'
    } catch(e) { console.warn(e) }
  }

  // 备用检测方案
  return ('ontouchstart' in window) || (window.innerWidth <= 768)
}